﻿using System;
using System.Windows.Forms;
using System.Xml;
using ZPTJCX.DAL;

namespace ZPTJCX
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            //ServiceReference1.a client = new WebReferenceNew.SmsSend();

            //ServiceReference1.aitmskdws client = new ServiceReference1.aitmskdws();
            //string xmlPath = client.JKZP_UserList();
            //if (PP.kdws == null)
            //{
            //    PP.kdws = new JKZP.aitmskdws.aitmskdws();
            //    PP.kdws.Url = "http://" + PP.gServerIP + "/aitmskdws/aitmskdws.asmx";
            //    PP.kdws.Discover();
            //}
            //XmlDocument doc = new XmlDocument();
            //doc.LoadXml(xmlPath);
            //XmlNodeList nodes = doc.SelectNodes("param/user");
            //if ((nodes != null) && (nodes.Count > 0))
            //{
            //    string[] userlist = new string[nodes.Count];
            //    for (int i = 0; i < nodes.Count; i++)
            //    {
            //        userlist[i] = nodes[i].Attributes["username"].Value;
            //    }
            //    comboBox1.DataSource = userlist;
            //}

        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            //string zpsj = new TimeHelper().GetFormatDate(dateTimePicker1.Value, '-');
            try
            {
	            DateTime dtdate = dateTimePicker1.Value.Date;
	            dataGridView1.DataSource = new ZPCLXXDAL().GetAll(dtdate);
	            dataGridView2.DataSource = new ZPCLXXDAL().GetAll(dtdate, "1");
            }
            catch (System.Exception ex)
            {
                LogHelper.WriteLog(typeof(Form1), ex, ex.Message);
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            int selectIndex = dataGridView2.CurrentRow.Index;
            DateTime dtdate = dateTimePicker1.Value.Date;

            try
            {
                string nameValue = (String)(dataGridView2.Rows[selectIndex].Cells["zpr_sc"].Value);
                dataGridView3.DataSource = new ZPCLXXDAL().GetAll(nameValue, dtdate, "0");
            }
            catch (System.Exception ex)
            {
                LogHelper.WriteLog(typeof(Form1), ex, ex.Message);

            }

        }
    }
}
